﻿<Window x:Class="Twi.COMMON.WPF.CustomDataGrid_Style"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Common="clr-namespace:Twi.COMMON.WPF"
        Style="{StaticResource Window_Style}"
        Title="列表样式自定义" Height="386" Width="544" WindowStartupLocation="CenterScreen">
    <Window.Resources>
        <Common:CommonConverter x:Key="CommonConverter"/>
    </Window.Resources>
    <Grid>
        <Common:CustomDataGrid AutoGenerateColumns="False" IsReadOnly="False" Margin="5,5,5,36" x:Name="DgCustomColumns" >
            <Common:CustomDataGrid.Columns>
                <DataGridTextColumn Header="列名称" Binding="{Binding Element[Header].Value}" Width="200" IsReadOnly="True"/>
                <DataGridTextColumn Header="列宽" Binding="{Binding Element[Width].Value}" Width="120"/>
                <DataGridTextColumn Header="显示顺序" Binding="{Binding Element[DisplayIndex].Value}" Width="80"/>
                <DataGridTemplateColumn Header="是否显示" Width="80" >
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox Margin="10,2,2,2"  IsChecked="{Binding Element[Visibility].Value, Converter={StaticResource CommonConverter}, ConverterParameter=BoolEN2}"  />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </Common:CustomDataGrid.Columns>
        </Common:CustomDataGrid>
        <StackPanel Orientation="Horizontal" Margin="0,3,2,2" HorizontalAlignment="Right" VerticalAlignment="Bottom">
            <Button Click="BtnSave_Click"  Height="24" HorizontalAlignment="Right" Margin="0,0,5,6" Name="BtnSave" TabIndex="90" VerticalAlignment="Bottom" Width="65">
                <Button.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFE8E8E8" Offset="0.478" />
                        <GradientStop Color="#FFC8C8C8" Offset="0.543" />
                        <GradientStop Color="#FFEEEFF2" Offset="0.983" />
                        <GradientStop Color="White" Offset="0.23" />
                    </LinearGradientBrush>
                </Button.Background>
                <Grid Height="17" Width="53">
                    <TextBlock Height="15" Margin="23,1,-3,1" Text="保存" TextWrapping="Wrap" />
                    <Image HorizontalAlignment="Left" Margin="3,0,0,1" Source="..\Images\保存.png" Stretch="Fill" Width="16" />
                </Grid>
            </Button>
            <Button Height="24" Click="BtnCancel_Click" HorizontalAlignment="Right" Margin="0,0,5,6" Name="BtnCancel" TabIndex="100" VerticalAlignment="Bottom" Width="65">
                <Button.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFE8E8E8" Offset="0.478" />
                        <GradientStop Color="#FFC8C8C8" Offset="0.543" />
                        <GradientStop Color="#FFEEEFF2" Offset="0.983" />
                        <GradientStop Color="White" Offset="0.23" />
                    </LinearGradientBrush>
                </Button.Background>
                <Grid Height="17" Width="60">
                    <TextBlock HorizontalAlignment="Right" Margin="0,1,-1,1" Text="取消" TextWrapping="Wrap" Width="32" />
                    <Image HorizontalAlignment="Left" Margin="6.12,0,0,-1.043" Source="..\Images\取消.png" Stretch="Fill" Width="18.043" />
                </Grid>
            </Button>
            <Button Content="全选" Height="23" HorizontalAlignment="Right" Margin="0,0,5,7" Name="BtnSelAll" VerticalAlignment="Bottom" Width="52" Click="BtnSelAll_Click" />
            <Button Content="全不选" Height="23" HorizontalAlignment="Right" Margin="0,0,5,7" Name="BtnUnSelAll" VerticalAlignment="Bottom" Width="52" Click="BtnUnSelAll_Click" />
        </StackPanel>
    </Grid>
</Window>
